import React, { Component } from 'react'
import { KVOB } from "kv-ob";
// react 5 还可用class编写
export default class Video extends Component {
    constructor(props){
        super(props)
    }
    render() {
        // 用的props里边的match.params
        console.log(this.props)
        let { search } = this.props.location
        // 截取? ,并用decode 解码
        let query = decodeURI(search.slice(1))
        let entry = query.split('&')
        let obj = {}
        entry.forEach(params => {
            var back = params.split('=')
            obj[back[0]]=  back[1]
        });
        console.log(obj)
        return (
            <div>
                <h2>前端 我是Video-- {obj.id}</h2>
                <h2>前端 我是Video-- {obj.name}</h2>
                <h2>前端 我是Video-- {KVOB.parse(search).name}</h2>
            </div>
        )
    }
}
